﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _12_Combox
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            //设置下拉框默认选中项
            this.comboBox1.SelectedIndex = 0;
            //将枚举类型的值添加到下拉框中
            this.comboBox2.DataSource = Enum.GetValues(typeof(UserType));
           
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.labelContent.Text = this.comboBox1.SelectedItem.ToString();
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.label5.Text = this.comboBox2.SelectedItem.ToString();
        }
    }
}
